using FreeRedis;

namespace Vin.Extension.Redis.Extension;

public static class RedisClientExtension
{
    public static string GetDel(this RedisClient client, string key)
    {
        return client.GetDelAsync(key).Result;
    }

    public static async Task<string> GetDelAsync(this RedisClient client, string key)
    {
        var cmd = new CommandPacket("GETDEL")
            .InputKey(key);
        var objResult = await client.CallAsync(cmd);
        return objResult?.ToString() ?? "";
    }
}